package company.C360;

import java.util.*;
import java.util.stream.Collectors;

public class C3 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        Map<Integer, Integer> dict = new HashMap<>();
        for (int i = 1; i <= n; i++) {
            dict.put(i, i);
        }
        for (int i = 0; i < m; i++) {
            int methodType = sc.nextInt();
            if (methodType == 1)
                method1(dict, n);
            else if (methodType == 2) {
                method2(dict);
            }
        }
        Map<Integer, Integer> tmp = sortMapByValues(dict);
        for (Integer i : tmp.keySet()) {
            System.out.print(i + " ");
        }
    }

    private static void method1(Map<Integer, Integer> dict, int n) {
        for (Map.Entry<Integer, Integer> e : dict.entrySet()) {
            Integer value = e.getValue();
            if (value == 1)
                e.setValue(n);
            else
                e.setValue(value - 1);
        }
    }

    private static void method2(Map<Integer, Integer> dict) {
        for (Map.Entry<Integer, Integer> e : dict.entrySet()) {
            Integer value = e.getValue();
            if (value % 2 == 0)
                e.setValue(value - 1);
            else
                e.setValue(value + 1);
        }
    }

    public static <K extends Comparable, V extends Comparable> Map<K, V> sortMapByValues(Map<K, V> aMap) {
        HashMap<K, V> finalOut = new LinkedHashMap<>();
        aMap.entrySet()
                .stream()
                .sorted((p1, p2) -> p1.getValue().compareTo(p2.getValue()))
                .collect(Collectors.toList()).forEach(ele -> finalOut.put(ele.getKey(), ele.getValue()));
        return finalOut;
    }
}
